<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
            "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:appcc="http://java.sun.com/jsf/composite/components"
	template="/WEB-INF/layouts/template1CH.xhtml">

	<ui:define name="topmenu">
	</ui:define>

	<ui:define name="center">
		<!-- our form is not a jsf form... -->
		<script>$("form").attr('action','${request.contextPath}/app/logincheck');</script>

		<p:panel id="loginPanel" header="Login" styleClass="loginBox">
			<p:focus context="loginPanel" />
			<p:messages id="messages" />
			<p:outputPanel rendered="#{!(userContext.locale eq 'fr')}">
				<p>If you used our database schema example or if Celerio could
					not detect in your database schema the table used to store
					username/password pairs, you should use:</p>
				<ul>
					<li><strong>admin/admin</strong>: can access all data</li>
					<li>user/user: can access only home page</li>
				</ul>
			</p:outputPanel>
			<p:outputPanel rendered="#{userContext.locale eq 'fr'}">
				<p>Si vous utilisez la base de données d'exemple ou si Celerio
					n'a pas trouvé la table où sont stockés les login/mots de passe,
					alors pour vous connecter vous devez utiliser:</p>
				<ul>
					<li><strong>admin/admin</strong>: accède à toutes les
						données</li>
					<li>user/user: accède uniquement à la page d'accueil</li>
				</ul>
			</p:outputPanel>

			<table>
				<tbody>
					<c:if test="${not empty param.login_error}">
						<tr>
							<td colspan="2">${msg.login_error}</td>
						</tr>
					</c:if>
					<c:if test="${not empty param.session_expired}">
						<tr>
							<td colspan="2">${msg.session_expired}</td>
						</tr>
					</c:if>
					<tr>
						<td><label for="j_username"><strong>${msg.login_login}</strong></label></td>
						<td><c:if test="${not empty param.login_error}">
								<c:set var="username"
									value="${sessionScope.SPRING_SECURITY_LAST_USERNAME}" />
							</c:if> <input id="j_username" type="text" name="j_username"
							value="#{username}" /></td>
					</tr>
					<tr>
						<td style="width: 100px;"><label for="j_password"><strong>${msg.login_password}</strong></label></td>
						<td><input id="j_password" type="password" name="j_password" />
						</td>
					</tr>
				</tbody>
			</table>
			<p>
				<input id="_spring_security_remember_me" type="checkbox"
					name="_spring_security_remember_me" /> <label
					for="_spring_security_remember_me">${msg.login_rememberme}</label>
			</p>
			<input name="submit" type="submit" value="${msg.login_submit}" />
		</p:panel>
	</ui:define>
</ui:composition>
